#pragma once

#include "MeshFactory.h"
#include "gtest/gtest.h"

namespace {

// The fixture for testing class MeshFactory.
class MeshFactoryTest : public ::testing::Test {
 protected:
  // You can remove any or all of the following functions if its body
  // is empty.

  MeshFactoryTest() {
    // You can do set-up work for each test here.
  }

  virtual ~MeshFactoryTest() {
    // You can do clean-up work that doesn't throw exceptions here.
  }

  // If the constructor and destructor are not enough for setting up
  // and cleaning up each test, you can define the following methods:

  virtual void SetUp() {
    // Code here will be called immediately after the constructor (right
    // before each test).
  }

  virtual void TearDown() {
    // Code here will be called immediately after each test (right
    // before the destructor).
  }

  // Objects declared here can be used by all tests in the test case for Foo.
};


TEST_F(MeshFactoryTest, BuildSphereFromOctahedron) {
	Mesh3d newMesh_0;
	MeshFactory::buildSphere(newMesh_0, MeshFactory::FROM_OCTAHEDRON, 0);
	int expected = 8*3*(int)powl(4.0,0);
	EXPECT_EQ(expected, newMesh_0.getVertexArray().size()) << "Must have created an octahedron without subdivisions, that is, "<<expected<<" vertices";
	Mesh3d newMesh_1;
	MeshFactory::buildSphere(newMesh_1, MeshFactory::FROM_OCTAHEDRON, 1);
	expected = 8*3*(int)powl(4.0,1);
	EXPECT_EQ(expected, newMesh_1.getVertexArray().size()) << "Must have created an octahedron with 1 subdivision, that is, "<<expected<<" vertices";
	Mesh3d newMesh_2;
	MeshFactory::buildSphere(newMesh_2, MeshFactory::FROM_OCTAHEDRON, 2);
	expected = 8*3*(int)powl(4.0,2);
	EXPECT_EQ(expected, newMesh_2.getVertexArray().size()) << "Must have created an octahedron with 2 subdivisions, that is, "<<expected<<" vertices";
	Mesh3d newMesh_3;
	MeshFactory::buildSphere(newMesh_3, MeshFactory::FROM_OCTAHEDRON, 3);
	expected = 8*3*(int)powl(4.0,3);
	EXPECT_EQ(expected, newMesh_3.getVertexArray().size()) << "Must have created an octahedron with 3 subdivisions, that is, "<<expected<<" vertices";
}


TEST_F(MeshFactoryTest, DoesXyz) {
  // Exercises the Xyz feature of Foo.
}

}  // namespace